
// headers from this project
#include "builder.hpp"

// headers from standard libraries
#include <iostream>
#include <cassert>

/// DesignPatterns::builder
void DesignPatterns::builder::create_product() 
{
	m_p = new pizza; 
}

DesignPatterns::pizza * DesignPatterns::builder::get_product() 
{
	return m_p;
}
	
void DesignPatterns::builder::build_dough()
{
	assert(false);
}

void DesignPatterns::builder::build_sauce()
{
	assert(false);
}

void DesignPatterns::builder::build_topping()
{
	assert(false);
}

DesignPatterns::builder::~builder()
{
	delete m_p;
}
/// end DesignPatterns::builder


/// DesignPatterns::italian_pizza
void DesignPatterns::italian_pizza::build_dough()
{
	m_p->set_dough("italian pizza dough");
	std::cout << "build italian pizza dough" << std::endl;
}

void DesignPatterns::italian_pizza::build_sauce()
{
	m_p->set_sauce("italian pizza sauce");
	std::cout << "build italian pizza sauce" << std::endl;
}

void DesignPatterns::italian_pizza::build_topping()
{
	m_p->set_topping("italian pizza topping");
	std::cout << "build italian pizza topping" << std::endl;
}
/// end DesignPatterns::italian_pizza 


/// DesignPatterns::armenian_pizza
void DesignPatterns::armenian_pizza::build_dough()
{
	m_p->set_dough("armenian pizza dough");
	std::cout << "build armenian pizza dough" << std::endl;
}

void DesignPatterns::armenian_pizza::build_sauce()
{
	m_p->set_sauce("armenian pizza sauce");
	std::cout << "build armenian pizza sauce" << std::endl;
}

void DesignPatterns::armenian_pizza::build_topping()
{
	m_p->set_topping("armenian pizza topping");
	std::cout << "build armenian pizza topping" << std::endl;
}
/// end DesignPatterns::armenian_pizza

/// DesignPatterns::pizza
void DesignPatterns::pizza::set_topping(std::string a)
{
	m_topping = a;	
}

void DesignPatterns::pizza::set_sauce(std::string b)
{
	m_sauce = b;
}

void DesignPatterns::pizza::set_dough(std::string c)
{
	m_dough = c;
}

DesignPatterns::pizza::pizza()
	: m_topping("")
	, m_sauce("")
	, m_dough("")
	{
	}

/// end DesignPatterns::pizza

/// DesignPatterns::cook
void DesignPatterns::cook::set_pizza_product(builder * a)
{
	m_b = a;
}

void DesignPatterns::cook::create_pizza_product()
{
	m_b->create_product();
	m_b->build_dough();
	m_b->build_sauce();
	m_b->build_topping();
}

DesignPatterns::pizza * DesignPatterns::cook::get_pizza_product()
{
	 return m_b->get_product();
}

DesignPatterns::cook::~cook()
{
	 delete m_b;
}

/// end DesignPatterns::cook


